package com.dating.entities;

import android.os.AsyncTask;

import com.dating.libs.client.parttern.doit.OnTaskListener;

public class AsyntaskDating extends AsyncTask<String, Void, Boolean>{
	OnTaskListener _listener=null;
	public void setOnTaskListener(OnTaskListener listener){
		this._listener=listener;
	}
	// Asyntask
	@Override
	protected void onPreExecute() {
		if(_listener!=null)
			_listener.onPrepare();
		else{
			throw new NullPointerException("do you have not init Listener?");
		}
		super.onPreExecute();
	}
	@Override
	protected Boolean doInBackground(String... params) {
		if(_listener!=null){
			_listener.onDoBackground(params);
			return true;
		}
		return false;
	}
	@Override
	protected void onPostExecute(Boolean result) {
		if(_listener!=null)
			_listener.onComplete(result);
		super.onPostExecute(result);
	}
	public void run(String... values){
		this.execute(values);
	}
}
